<template>
  <div>
    <router-link v-if="userId" :to="`/user/${userId}`" target="_blank">
        <Cover
            :lazy="lazy"
            :width="width"
            :source="avatar"
            :default-image="defaultImage"
            border-radius="50%"
            :scale="1">

        </Cover>
    </router-link>
    <Cover
        :lazy="lazy"
        :width="width"
        :source="avatar"
        :default-image="defaultImage"
        border-radius="50%"
        :scale="1"
        v-else></Cover>
  </div>
</template>
<script setup>
  const props = defineProps({
    avatar: {
      type: String
    },
    userId: {
      type: Number
    },
    lazy: {
      type: Boolean
    },
    width: {
      type: Number,
      default: 40
    },
    defaultImage: {
      type: String,
      default: '@/assets/user.png'
    }
  })
</script>
<style scoped>

</style>